<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>intersect</title>
</head>

<body>
    <div>打开浏览器控制台查看结果</div>
    <script>
        function intersect(...arg) {
            const res = new Map(),
                intersect = [];
            arg.forEach(item =>
                [...new Set(item)].forEach(val =>
                    res.set(val, res.get(val) ? res.get(val) + 1 : 1)
                )
            );
            res.forEach((value, key) => value === arg.length && intersect.push(key));
            return intersect;
        }
        console.log(intersect([1, 6, 7, 43, 9, 54, 7], [4, 7, 9, 76, 54, '6', '1']));; // [7,9,54]
        console.log(intersect(
            [1, 6, 7, 43, 9, 54, 7],
            [4, 7, 9, 76, 54, '6', '1'],
            [1, 424, 54, 4]
        ));; // [54]
    </script>
</body>

</html>